#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Time   :2020/8/7 10:25
# Author : fengzhilaoling

from flask import Flask

app = Flask('my_app')


@app.before_first_request
def one():
    print('网站启动后，第一次请求执行')


@app.before_request
def auto():
    print('每次访问前执行')


@app.after_request
def last_response(result):
    print('每次返回结果前执行')
    return result


@app.errorhandler(404)
def error_404(error):
    print(error)
    return '404页面'


@app.route('/')
def index():
    print('index,执行中')
    return '主页'


if __name__ == '__main__':
    app.run(debug=True)
